<?php
namespace wlcat\http\controllers;
use wlcat\http\view\View;
use wlcat\src\Register;

class Controller
{
    protected $_controller;
    protected $_action;
    protected $_view;
    protected $request;
    // 构造函数，初始化属性，并实例化对应模型
    function __construct($controller, $action)
    {
        $this->_controller  = $controller;
        $this->_action      = $action;
        $this->_view        = new View($controller, $action);
        $this->request      = Register::get(Register::REQUEST_CLASS);
    }
    // 分配变量
    function assign($name, $value)
    {
        $this->_view->assign($name, $value);
    }
    function display($file = '')
    {
        $this->_view->display($file);
    }
}